package com.bsoft.exchange.webservice.impl;

import com.bsoft.exchange.domain.Test;
import com.bsoft.exchange.domain.UserDomain;
import com.bsoft.exchange.response.ResponseEntity;
import com.bsoft.exchange.vo.UserVo;
import com.bsoft.exchange.webservice.UserService;

import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.jws.WebService;

@WebService(serviceName="UserService",//对外发布的服务名
                     targetNamespace="http://webservice.exchange.bsoft.com",//指定你想要的名称空间，通常使用使用包名反转
                     endpointInterface="com.bsoft.exchange.webservice.UserService")//服务接口全路径, 指定做SEI（Service EndPoint Interface）服务端点接口
 @Component
public class UserServiceImpl implements UserService {
	
	@Autowired
    Mapper dozerMapper;
	

    @Override
    public ResponseEntity<UserVo>  getUser(int userId) {
        ResponseEntity<UserVo> entry = new ResponseEntity<UserVo>();
        
        //换成service具体方法
      UserDomain userDomain =  getUserDomain(userId);

      //实体bean转换
      UserVo userVo = dozerMapper.map(userDomain, UserVo.class);
      
        entry.setData(userVo);
        return entry;
    }

    @Override
    public ResponseEntity<String> getUserName(String userName) {
    	
//    	Test t = testservice.gettest(userName);
        ResponseEntity<String> entry = new ResponseEntity();
//        entry.setData(t.getName());
        return entry;
    }
    
    
    private UserDomain getUserDomain(int userId){
    	
		
//		userMapper.select()
		
        UserDomain userDomain = new UserDomain();
        userDomain.setJlxh(userId);
        userDomain.setName("张三");
        userDomain.setNickName("ddddd");
        userDomain.setPwd("dd23432");
        System.out.println(userDomain);
        return userDomain;
        
    }
}
